
var callBackFun;

function checkEmergency(){	
	//alert("checkEmergency");
	var timestamp = Date.parse(new Date());
	$.get("work/CheckStartPlan_findPStatusByEId.action?ts="+timestamp+"&EId="+getCookie(eventId),null,checkEmergencyRst);
}

function checkEmergencyRst(data){
	//alert("checkEmergencyRst");
	//alert(data.ajaxRst);
	if(data.ajaxRst=="1"){
		//window.parent.location.href="/zrt/loadPlanStep.action";
		//redirectPage("/ag/work/reportTable.jsp");
		//window.parent.frames['mainFrame'].location.href="/ag/work/reportTable.jsp";
		setEventPlan2Session();
	}else{
		//redirectPage("/ag/work/reportTableCheck.jsp");
		setEventPlan2SessionNoPlan();
	}
}

function findEventStatusAjax(param){
	callBackFun=param;
	//alert("back");
	var timestamp = Date.parse(new Date());
	$.get("work2/LZMReport_findEventStatus.action?ts="+timestamp+"&EId="+getCookie(eventId),null,findEventStatusRst);
}

function findEventStatusRst(data){
	//alert("callbaco");
	if(data.ajaxRst=="success"){
		//window.parent.location.href="zrt/loadPlanStep.action";
		//window.parent.location.href="/ag/zrt/loadPlanStep.action";
		//return data.eventStatus;
		callBackFun(data.eventStatus);
	}else{
		alert("服务器异常，请重试！");
		callBackFun("");
		//return 1000;
	}
}

function judgeEventStatus4Report(){
	findEventStatusAjax(report);
	//alert("findEventStatusAjax"+getCookie(eventStatus));
}
/**
 * 真正处理函数
 * @param {Object} data
 */
function report(eventStatus){
	//alert(eventStatus);
	//eventStatus="1001";
	if(eventStatus=="1001"){
		//window.parent.frames['mainFrame'].location.href="/ag/work/reportTable4dbld.jsp";
		$('#tabFrame', window.parent.document).attr("src", "/ag/work/reportTable4dbld.jsp");
	}else{
		//window.parent.frames['mainFrame'].location.href="/ag/work/reportTable.jsp";
		$('#tabFrame', window.parent.document).attr("src", "/ag/work/reportTable.jsp");
	}
}


